<template>
  <div>
    <nav-bar></nav-bar>
    <div class="banner">
      <img :src="obj.new_pic_url" alt="" />
      <div class="info">
        <span>{{ obj.name }}</span>
      </div>
    </div>
    <div class="info-desc">{{ obj.simple_desc }}</div>
    <div class="banner-info" v-if="num == '0'">数据库暂无数据</div>
    <div class="brandlist" v-if="num != '0'">
      <div class="item" v-for="item in goodsList" :key="item.id">
        <img :src="item.list_pic_url" alt="" />
        <p class="desc">{{ item.name }}</p>
        <p class="price">￥{{ item.retail_price }}</p>
      </div>
    </div>
  </div>
</template>

<script>
import Navbar from "../../../components/Navbar";
import { detailaction } from "@/api/home/brand/index.js";
export default {
  props: {},
  data() {
    return {
      obj: {},
      num: "",
      goodsList: [],
    };
  },
  computed: {},
  created() {
    const id = this.$route.query.ids;
    detailaction({
      id: id,
    }).then((res) => {
      console.log(res);
      this.obj = res.data;
      this.goodsList = res.goodsList;
      this.num = this.goodsList.length;
    });
  },
  mounted() {},
  watch: {},
  methods: {},
  components: {
    "nav-bar": Navbar,
  },
};
</script>

<style lang="scss" scoped>
.banner {
  width: 100%;
  height: 145px;
  position: relative;
  img {
    width: 100%;
    height: 100%;
  }
  .info {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    span {
      font-size: 20px;
      color: #fff;
      border-bottom: 2px solid #fff;
      padding: 2px;
    }
  }
}
.info-desc {
  background: #fff;
  padding: 21px 16px;
  font-size: 15px;
  color: #666;
  text-align: center;
}
.banner-info {
  text-align: center;
  color: #999;
  font-size: 0.42667rem;
  margin-top: 2.66667rem;
}
.brandlist {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  .item {
    width: 4.96667rem;
    margin-bottom: 0.06667rem;
    text-align: center;
    background: #fff;
    padding: 0.2rem 0;
    img {
      display: block;
      width: 4.02667rem;
      height: 4.02667rem;
      margin: 0 auto;
    }
    .desc {
      margin: 0.2rem 0 0.29333rem 0;
      text-align: center;
      padding: 0 0.26667rem;
      font-size: 0.32rem;
    }
    .price {
      text-align: center;
      font-size: 0.4rem;
      color: #b4282d;
    }
  }
}
</style>
